-
Notifications
You must be signed in to change notification settings - Fork 537
[PyTorch] Add max_logit support for MuonClip #2195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Charlene Yang <[email protected]>
skyw
reviewed
Sep 26, 2025
Signed-off-by: Charlene Yang <[email protected]>
Signed-off-by: Charlene Yang <[email protected]>
Signed-off-by: Charlene Yang <[email protected]>
Signed-off-by: Charlene Yang <[email protected]>
for more information, see https://pre-commit.ci
Signed-off-by: Charlene Yang <[email protected]>
Signed-off-by: Charlene Yang <[email protected]>
for more information, see https://pre-commit.ci
Signed-off-by: Charlene Yang <[email protected]>
for more information, see https://pre-commit.ci
Signed-off-by: Charlene Yang <[email protected]>
for more information, see https://pre-commit.ci
Signed-off-by: Charlene Yang <[email protected]>
Signed-off-by: Charlene Yang <[email protected]>
for more information, see https://pre-commit.ci
Signed-off-by: Charlene Yang <[email protected]>
for more information, see https://pre-commit.ci
|
/te-ci L1 |
|
/te-ci L1 |
Signed-off-by: Charlene Yang <[email protected]>
Signed-off-by: Charlene Yang <[email protected]>
Signed-off-by: Charlene Yang <[email protected]>
|
LGTM thx |
Signed-off-by: Charlene Yang <[email protected]>
Signed-off-by: Charlene Yang <[email protected]>
Signed-off-by: Charlene Yang <[email protected]>
Signed-off-by: Charlene Yang <[email protected]>
Signed-off-by: Charlene Yang <[email protected]>
for more information, see https://pre-commit.ci
|
/te-ci L1 |
skyw
approved these changes
Oct 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BoxiangW has reviewed and LGTM.
Approving.
|
One more thing on this PR, I think we agreed before on changing the naming into |
Signed-off-by: Charlene Yang <[email protected]>
Signed-off-by: Charlene Yang <[email protected]>
Signed-off-by: Charlene Yang <[email protected]>
Signed-off-by: Charlene Yang <[email protected]>
Signed-off-by: Charlene Yang <[email protected]>
|
/te-ci L1 |
|
LGTM |
Signed-off-by: Charlene Yang <[email protected]>
|
/te-ci L1 |
vcherepanov-nv
approved these changes
Oct 24, 2025
BoxiangW
approved these changes
Oct 24, 2025
KshitijLakhani
pushed a commit
that referenced
this pull request
Oct 28, 2025
* add max_score for fused/unfused F16 non-CP Signed-off-by: Charlene Yang <[email protected]> * calculate max per head instead of max over all heads Signed-off-by: Charlene Yang <[email protected]> * fix fused attn max_score shape Signed-off-by: Charlene Yang <[email protected]> * revert FE to github Signed-off-by: Charlene Yang <[email protected]> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update FE to 1.15.0-rc Signed-off-by: Charlene Yang <[email protected]> * fix merge Signed-off-by: Charlene Yang <[email protected]> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * reduce ew kernels; fix causal masks; add more tests Signed-off-by: Charlene Yang <[email protected]> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * minor fix to tests Signed-off-by: Charlene Yang <[email protected]> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * remove logic for flash-attn Signed-off-by: Charlene Yang <[email protected]> * WIP: add CP support for p2p/a2a/all_gather Signed-off-by: Charlene Yang <[email protected]> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * minor improvements of implementation/tests Signed-off-by: Charlene Yang <[email protected]> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * WIP: add thd support Signed-off-by: Charlene Yang <[email protected]> * add thd to UnfusedDPA Signed-off-by: Charlene Yang <[email protected]> * fix lint Signed-off-by: Charlene Yang <[email protected]> * more fixes for lint Signed-off-by: Charlene Yang <[email protected]> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update to FE 1.15 Signed-off-by: Charlene Yang <[email protected]> * remove unneeded changes Signed-off-by: Charlene Yang <[email protected]> * disable unfused for thd + pad_between_seqs Signed-off-by: Charlene Yang <[email protected]> * minor fixes Signed-off-by: Charlene Yang <[email protected]> * disable thd for unfused until bug is fixed Signed-off-by: Charlene Yang <[email protected]> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix all_gather Signed-off-by: Charlene Yang <[email protected]> * fix all gather Signed-off-by: Charlene Yang <[email protected]> * rename max_score to max_logit Signed-off-by: Charlene Yang <[email protected]> * fix all_gather Signed-off-by: Charlene Yang <[email protected]> * fix all_gather Signed-off-by: Charlene Yang <[email protected]> * disable fused attn + thd Signed-off-by: Charlene Yang <[email protected]> --------- Signed-off-by: Charlene Yang <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds
max_logitsupport inFusedAttentionandUnfusedDotProductAttentionbackends in TE-PyTorch.max_logitis the max ofmask(Q x K^T x scale + bias), and it is used by MuonClip optimizer to rescale Q and K projection weights.This PR supports FP16, BF16 precisions and BSHD, SBHD formats. It supports non-CP and CP (
cp_comm_type = {"p2p", "a2a", "a2a+p2p", "all_gather"}) cases.It contains a breaking change: adding
return_max_logitto thenvte_get_fused_attn_backend,nvte_fused_attn_fwdandnvte_fused_attn_bwd. TE will pack up the tensor and non-tensor arguments in these APIs as structs in the future, in order to avoid breaking changes like this.The support for THD is also implemented in this PR and will be enabled when cuDNN supports it.
This PR requires cuDNN 9.13.1 and cudnn-frontend 1.15.
Type of change
Changes
Please list the changes introduced in this PR:
max_logitsupport inFusedAttentionandUnfusedDotProductAttentionChecklist: